package com.ttl.common.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class DBConnect {
	
    public Connection conn = null;
    public Statement st = null;
    public ResultSet rs= null;
    public void connectDB() throws Exception{
        
    /* connect MySQL
    String connectionURL ="jdbc:mysql://localhost/weaving";
    Class.forName("com.mysql.jdbc.Driver");
    */  
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
        String url = "jdbc:odbc:ttl51";
        conn = DriverManager.getConnection(url,"sa","admin@123");
        st=conn.createStatement();
    }
    
    public void closeDB(){
        if(conn!=null){
            try{
                st.close();
                conn.close();
            }catch(Exception e){}
        }
    }
}
